import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    redirect: '/home',
    component: Home,
    children: [
      {
        path: 'home',
        name: 'home',
        component: () => import('@/views/Home'),
      }
    ]
  },
  {
    path: '/user',
    name: 'admin user',
    component: () => import('@/components/user_admin/User.vue'),
    children: [
      {
        path: 'ad_user',
        name: 'user add and delete',
        component: () => import('@/components/user_admin/ADUser.vue')
      }
    ]
  },
  {
    path: '/content',
    name: 'content admin',
    redirect: 'img',
    component: () => import('@/components/content_admin/ContentLayout.vue'),
    children: [
      {
        path: 'img',
        name: 'content images admin',
        component: () => import('@/components/content_admin/image_admin/ImageLayout.vue'),
        children: [
          {
            path: 'banner',
            name: 'content images banner admin',
            components: {
              add: () => import('@/components/content_admin/image_admin/BannerAdd.vue'),
              data: () => import('@/components/content_admin/image_admin/Banner.vue'),
            },
          },
          {
            path: 'adv',
            name: 'content images adv admin',
            components: {
              add: () => import('@/components/content_admin/image_admin/AdvAdd.vue'),
              data: () => import('@/components/content_admin/image_admin/Adv.vue'),
            },
          },
          
        ]
      },
      {
        path: 'news',
        name: 'content news admin',
        components: {
          data: () => import('@/components/content_admin/news_admin/News.vue'),
        }
      },
      {
        path: 'article',
        name: 'content articles admin',
        components: {
          data: () => import('@/components/content_admin/article_admin/Article.vue'),
        }
      },
      {
        path: 'active_page',
        name: 'content active_page admin',
        components: {
          add: () => import('@/components/content_admin/active_page_admin/ActiveAdd.vue'),
          data: () => import('@/components/content_admin/active_page_admin/Active.vue'),
        }
      },
      {
        path: 'sd',
        name: 'content sd admin',
        redirect: 'supply',
        component: () => import('@/components/content_admin/ContentLayout.vue'),
        children: [
          {
            path: 'supply',
            name: 'content sd supply admin',
            component: () => import('@/components/content_admin/sd_admin/supply_admin/Supply.vue'),
          },
          {
            path: 'demand',
            name: 'content sd demand admin',
            component: () => import('@/components/content_admin/sd_admin/demand_admin/Demand.vue'),
          }
        ]
      }

    ]
  },
  {
    path: '/seo',
    redirect: 'seo admin',
    component: () => import('@/components/seo_admin/Seo.vue'),
    children: [
      {
        path: 'usage',
        name: 'seo usage admin',
        component: () => import('@/components/seo_admin/SeoUsage.vue')
      },
      {
        path: 'site_info',
        name: 'seo info admin',
        component: () => import('@/components/seo_admin/SiteInfo.vue')
      },
      {
        path: 'upload_file',
        name: 'seo file admin',
        component: () => import('@/components/seo_admin/File.vue')
      },
      {
        path: 'short_link',
        name: 'seo short link admin',
        component: () => import('@/components/seo_admin/ShortLink.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory("/htgl/"),
  routes
})

export default router
